import DialogModal from "@/components/DialogModal";
import { Button, Form, Radio, Space } from "antd";
import { useState, forwardRef, useImperativeHandle } from "react";
import style from "./index.module.less";

interface Props {
  onSuccess: Function
}
export default forwardRef((props: Props, ref: any) => {
  const [show, setShow] = useState(false)

  const [form] = Form.useForm();
  // 表单的确认
  const onFinish = (values: any) => {
    // 关闭弹框
    setShow(false);
    // 确定的回调
    props.onSuccess(values)
  };

  // 显示弹框
  const showDialog = () => {
    setShow(true);
  }
  // 关闭弹框
  const hideDialog = () => {
    setShow(false);
  }

  // 自定义暴露给父组件的实例值
  useImperativeHandle(ref, () => ({
    showDialog,
    hideDialog
  }))

  return(
    <div></div>
  )
})